layui.define(["form", "layer", "admin", "table", "upload", "element"], function (exports) {
    var $ = layui.$,
        form = layui.form,
        layer = layui.layer,
        admin = layui.admin,
        upload = layui.upload,
        table = layui.table;

    //设定文件大小限制
    upload.render({
        elem: '#console-express-import-btn',
        url: '/bil/importBilExpressNo',
        data: {"access_token": layui.data('layuiAdmin').access_token},
        size: 5000, //限制文件大小，单位 KB
        field: "bilExpressNoFile",
        accept: "file",
        exts: "xlsx|xls",
        before: function(obj) {
            layer.load(2, {time: 100 * 1000});
        },
        done: function (res) {
            layer.closeAll('loading');
            if(res.code === 0) {
                layer.alert('导入成功, 一共' + res.data.total + "条数据, 匹配了" + res.data.count + "条。", {icon: 6});
            } else{
                layer.msg("上传失败", {icon: 5, time: 1500});
            }
        }
    });

    exports("console", {});
});